{% comment %}
<!--
  Copyright (C) 2008 ZHENG Zhong <http://www.zhengzhong.net/>

  Created on 2009-05-11.
  $Id$
-->
{% endcomment %}

<div id="profile" class="ajax_box">

  <!-- main _____________________________________________________________________________________-->
  
  <div class="main">
  
    <div class="user_name">
      <h1>{{hot_user.nickname|escape}}</h1>
    </div><!--/.user_name-->
    
    {% include "hottywood/ajax/ajax_error.html" %}
  
  </div><!--/.main-->
  
  <!-- container ________________________________________________________________________________-->
  
  <div class="container">
  
    <!-- photo __________________________________________________________________________________-->
    
    <div class="photo">
    
      {% if hot_user.has_photo %}
        <img src="{{webapp_}}/user/{{hot_user.user_id}}/photo/"
             alt="{{hot_user.nickname|escape}}'s photo"
             title="{{hot_user.nickname|escape}}'s photo"/>
      {% else %}
        {% ifequal hot_user.sex "male" %}
          <img src="{{static_}}/images/male_no_photo.jpg"
               alt="{{hot_user.nickname|escape}} (no photo)"
               title="{{hot_user.nickname|escape}} (no photo)"/>
        {% else %}
          <img src="{{static_}}/images/female_no_photo.jpg"
               alt="{{hot_user.nickname|escape}} (no photo)"
               title="{{hot_user.nickname|escape}} (no photo)"/>
        {% endifequal %}
      {% endif %}
    
    </div><!--/.photo-->
    
    <!-- resume _________________________________________________________________________________-->
    
    <div class="resume">
    
      <!-- view _________________________________________________________________________________-->
      
      <div class="view">
      
        <div class="section">
          <h3>Contributions:</h3>
          <div>
            <em>{{hot_user.nickname|escape}}</em>
            {% if hot_user.full_name %}
              <em>({{hot_user.full_name|escape}})</em>
            {% endif %}
            made {{hot_user.his}} first contribution to <em>Hottywood</em> on
            <em>{{hot_user.register_date|date:"Y-m-d"}}</em>. Since then, {{hot_user.he}} has added
            <em>{{hot_user.movies_added}} movies</em>, <em>{{hot_user.scenes_added}} scenes</em>,
            and voted for <em>{{hot_user.scenes_voted}} scenes</em>. {{hot_user.he.capitalize}} has
            therefore got <em>{{hot_user.points}} points</em> by {{hot_user.his}} kindly
            contributions. <em>Thanks, {{hot_user.nickname|escape}}!</em>
          </div>
        </div>
        
        <div class="section">
          <h3>Bio:</h3>
          {% if hot_user.bio %}
            <div>{{hot_user.bio|escape|linebreaks}}</div>
          {% else %}
            <div class="na">{{hot_user.nickname|escape}} doesn't have a bio.</div>
          {% endif %}
        </div>
        
        {% if hot_user.is_current_user or is_admin_ %}
          <div class="toggle_link">
            <a href="javascript:void(0);" onclick="toggleBox('#profile');">
              [edit your profile]
            </a>
          </div>
        {% endif %}
      
      </div><!--/.view-->
      
      <!-- edit ___________________________________________________________________________________-->
      
      {% if hot_user.is_current_user or is_admin_ %}
      
        <div id="edit_tabs" class="edit hidden tabs">
        
          <div class="tab_toggles">
            <a class="tab_toggle selected"
               href="#edit_basic_info_form"
               onclick="return switchTab('#edit_tabs', '#edit_basic_info_form');">
              Basic information
            </a>
            <a class="tab_toggle"
               href="#upload_photo_form"
               onclick="return switchTab('#edit_tabs', '#upload_photo_form');">
              Photo
            </a>
          </div><!--/.tab_toggles-->
          
          <div class="tab_panels">
          
            <form id="edit_basic_info_form" class="small form" action="." method="POST"
                  onsubmit="return submitAjaxForm('#profile', '#edit_basic_info_form');">
              <input type="hidden" name="ajax_box" value="profile"/>
              <table>
                <tbody>
                  <tr>
                    <th style="width:1%;"><span class="nowrap">Full name :</span></th>
                    <td>
                      <input type="text" name="full_name" value='{{hot_user.full_name|default:""|escape}}'/>
                    </td>
                  </tr>
                  <tr>
                    <th style="width:1%;"><span class="nowrap">Sex :</span></th>
                    <td>
                      <span><input type="radio" name="sex" value="female"/> female</span>
                      <span><input type="radio" name="sex" value="male"/> male</span>
                      <span><input type="radio" name="sex" value=""/> it's a secret</span>
                    </td>
                  </tr>
                  <tr>
                    <th style="width:1%;"><span class="nowrap">Bio :</span></th>
                    <td>
                      <textarea name="bio">{{hot_user.bio|default:""|escape}}</textarea>
                    </td>
                  </tr>
                  <tr>
                    <th style="width:1%;"></th>
                    <td>
                      <input class="button" type="submit" value="Update"/>
                      <input class="button" type="button" onclick="toggleBox('#profile');" value="Cancel"/>
                      <span class="ajax_indicator hidden">
                        <img src="{{static_}}/images/ajax_indicator.gif" alt="AJAX Indicator"/>
                      </span>
                    </td>
                  </tr>
                </tbody>
              </table>
            </form><!--/#edit_basic_info_form-->
            
            <form id="upload_photo_form"
                  class="small form hidden"
                  action="{{webapp_}}/user/{{hot_user.user_id}}/photo/"
                  method="POST"
                  enctype="multipart/form-data">
              <table>
                <tbody>
                  <tr>
                    <th style="width:1%;"><span class="nowrap">Upload a photo :</span></th>
                    <td><input type="file" name="photo" size="20"/></td>
                  </tr>
                  <tr>
                    <th style="width:1%;"></th>
                    <td>
                      {% if hot_user.has_photo %}
                        <div>
                          <input type="checkbox" name="delete" value="true"/>
                          Delete my photo.
                        </div>
                      {% else %}
                        <input type="hidden" name="delete"/>
                      {% endif %}
                      <input class="button" type="submit" value="Upload"/>
                      <input class="button" type="button" onclick="toggleBox('#profile');" value="Cancel"/>
                    </td>
                  </tr>
                </tbody>
              </table>
            </form><!--/#upload_photo_form-->
          
          </div><!--/.tab_panels-->
        
        </div><!--/.edit-->
      
      {% endif %}{# hot_user.is_current_user or is_admin_ #}
    
    </div><!--/.resume-->
    
    <!-- clear __________________________________________________________________________________-->
    
    <div class="clear"></div>
  
  </div><!--/.container-->
  
</div><!--/#profile-->







